function getUrlParams(url) {
  url = url || location.search;
  const params = {};
  if (url) {
    url = url.split('?')[1];
    const paramsArr = url.split(',');
    paramsArr.forEach((val) => {
      const paramsList = val.split('=');
      params[paramsList[0]] = paramsList[1]
    })
  }
  return params;
}

function getUrlParam(key, url) {
  const params = getUrlParams(url);
  return params[key];
}
